import request from '@/utils/request'
import qs from 'qs'

export function login(username, password) {
  const params = qs.stringify({
    username,
    password
  })
  return request({
    url: '/login',
    method: 'post',
    data: params,
    headers: {
      'Content-type': 'application/x-www-form-urlencoded;charset=utf-8;'
    }
  })
}

export function getInfo(username) {
  return request({
    url: '/User/list?username=' + username + '&offset=0&limit=1',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}
